package com.hqd.jjvm.instructions;

public enum ArrayType {
	AT_BOOLEAN(4, "[Z"),
	AT_CHAR(5, "[C"),
	AT_FLOAT(6, "[F"),
	AT_DOUBLE(7, "[D"),
	AT_BYTE(8, "[B"),
	AT_SHORT(9, "[S"),
	AT_INT(10, "[I"),
	AT_LONG(11, "[J");
	private int atype;
	private String classTypeName;

	ArrayType(int atype, String classTypeName) {
		this.atype = atype;
		this.classTypeName = classTypeName;
	}

	public static ArrayType getArrayType(int atype) {
		for (ArrayType arrayType : values()) {
			if (arrayType.atype == atype) {
				return arrayType;
			}
		}
		return null;
	}

	public String getClassTypeName() {
		return classTypeName;
	}
}
